<template>
	<view class="row">
		<view class="col-auto">
			<slot></slot>
		</view>
		<view v-if="pageInfo">
			<view class="row ">
				<uni-pagination :prevText="'上一页'" :nextText="'下一页'" :total="pageInfo.totalPage"
					:pageSize="pageInfo.limit" :current="pageInfo.page" @change="pagination">
				</uni-pagination>
				<!-- <gt-select class="input-line input-sm page-limit ml-15" :placeholder="$t('请选择')" :list="pageLimitList" placeholder="10"
					:value.sync="pageInfo.limit" @change="changePageLimit"></gt-select> -->
				<!-- <input class="input-line input-page ml-15 mr-15" type="number" v-model="searchPage" />
				<button class="btn btn-sm " @click="skipPage()"
					:disabled="searchPage == '' || searchPage ==  pageInfo.page || searchPage > pageInfo.totalPage">{{ $t('跳转') }}</button>
			 -->
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "",
		props: {
			pageInfo: {
				type: [Array, Object],
				default: function() {
					return {
						page: 1,
						totalPage: 0,
						limit:10
					};
				}
			}
		},
		created() {},
		data() {
			return {
				batchSelectIndexList: [],
				pageLimitList: [{
						key: 20,
						val: '20'
					},
					{
						key: 30,
						val: '30'
					},
					{
						key: 50,
						val: '50'
					},
					{
						key: 100,
						val: '100'
					},
				],
				searchPage: ''
			}
		},
		methods: {
			changePageLimit(e) {
				this.$emit('change',{
					page:this.pageInfo.page || 1,
					limit:e || 10,
					totalPage:this.pageInfo.totalPage || ''
				})
			},
			// 分页获取列表
			pagination(e) {
				this.$emit('change',{
					page:e.current,
					limit:this.pageInfo.limit || 10,
					totalPage:this.pageInfo.totalPage || ''
				})
			},
			// 分页跳转
			skipPage() {
				this.$emit('change',{
					page:this.searchPage,
					limit:this.pageInfo.limit || 10,
					totalPage:this.pageInfo.totalPage || ''
				})
				this.searchPage = '';
			}
		}
	}
</script>

<style>

	.showTrChild,
	.showTrChild td,
	.showTrChild .td-content {
		min-height: 50px;
		animation: showTr .3s;
	}

	@keyframes showTr {
		form: {
			height: 0 !important;
			padding: 0 !important;
			overflow: hidden !important;
			border-top: none !important;
		}

		to: {
			min-height: 50px;
			background-color: aqua;
		}
	}

	.hideTrChild,
	.hideTrChild td,
	.hideTrChild .td-content {
		height: 0 !important;
		padding: 0 !important;
		overflow: hidden !important;
		border-top: none !important;
		animation: hideTr .3s;
	}

	@keyframes hideTr {
		form: {
			min-height: 100px;
		}

		to: {
			height: 0 !important;
			padding: 0 !important;
			overflow: hidden !important;
			border-top: none !important;
		}
	}

	button {
		border: none;
	}

	.page--active {
		background-color: black;
	}

	.page-limit {
		width: 80px;
		height: 28px;
	}
</style>